import 'package:dio/dio.dart';
import 'package:flutter_syt/starter/http/http_code.dart';

class HttpResponse {
  dynamic data;
  String? message;
  int? code;

  // dynamic json;
  DioExceptionType? type;

  HttpResponse({
    this.data,
    this.code,
    this.message,
    this.type,
    // this.json,?
  });

  factory HttpResponse.fromJson(Map? json) => HttpResponse(
        data: json?["data"],
        code: json?["code"],
        message: json?["msg"] ?? json?["message"],
      );

  bool get isSuccess {
    // && data != null
    return HttpCode.code200 == code ;
  }
}
